package com.pospi.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.pospi.pai.yunpos.R;
import com.pospi.pai.yunpos.vip.VipGoodsBeen;
import com.pospi.pai.yunpos.vip.VipReportActivity;

import java.util.List;

import static com.pospi.pai.yunpos.R.id.view;

/**
 * Created by acer on 2018/8/27.
 */

public class VipSaleAdapter extends BaseAdapter {
    private Context context;
    private List<VipGoodsBeen> beens;

    public VipSaleAdapter(Context context, List<VipGoodsBeen> beens) {
        this.context = context;
        this.beens = beens;
    }

    @Override
    public int getCount() {
        return beens.size();
    }

    @Override
    public Object getItem(int position) {
        return beens.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Holder holder ;
        if (convertView == null) {
            holder = new Holder();
            convertView = LayoutInflater.from(context).inflate(R.layout.vipgoods_item, null);
            holder.xh = convertView.findViewById(R.id.tv_xh);
            holder.name = convertView.findViewById(R.id.tv_name);
            holder.xsje = convertView.findViewById(R.id.tv_xsje);
            holder.xssl = convertView.findViewById(R.id.tv_xssl);
            holder.mle = convertView.findViewById(R.id.tv_xsmle);
            holder.mlr = convertView.findViewById(R.id.tv_xsmlr);
            holder.tv_time = convertView.findViewById(R.id.tv_time);
            convertView.setTag(holder);
        } else {
            holder = (Holder) convertView.getTag();
        }
        VipGoodsBeen been = beens.get(position);
        holder.xh.setText(position+1+"");
        holder.name.setText(been.getGoodsname());
        holder.xsje.setText(been.getXsjje());
        holder.xssl.setText(been.getMarketname());
        holder.mle.setText(been.getSl());
        holder.mlr.setText(been.getType());
        holder.tv_time.setText(been.getSendrq());
        return convertView;
    }
    class Holder{
        TextView xh;
        TextView name;
        TextView xsje;
        TextView xssl;
        TextView mle;
        TextView mlr;
        TextView tv_time;

    }
}
